package com.longge;

import java.util.Arrays;
import java.util.Deque;
import java.util.LinkedList;

/**
 * @program: my-code
 * @description:
 * @author: longge
 * @create: 2021-03-08 23:20
 */
public class ReverseLeftWords {
    public String reverseLeftWords(String s, int n) {
        char[] chars = s.toCharArray();
        char[] temp = new char[n];
        int node = 0;
        for (int i = 0; i < chars.length; i++) {
            if (i<n){
                temp[i]=chars[i];
            }
            if (i+n<chars.length){
                chars[i]=chars[i+n];
            }else {
                chars[i]= temp[node++];
            }
        }
        return new String(chars);
    }
}
